$dark-color: #212121;
$light-color: #dadada;
$light-bg-color: #fafafa;
$dark-bg-color: #212121;
$light-bd-color: rgba(33, 33, 33, .7);
$dark-bd-color: rgba(218, 218, 218, .7);
$active-color: #1565c0;

* {
  word-break: break-all;
  box-sizing: border-box;
  outline: none;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

#cusdis_thread {
  margin-top: 6rem;
}

.highlight {
  position: relative;

  code {
    margin-top: 0.8rem;
  }

  .copy-code-btn {
    user-select: none;
    cursor: pointer;
    position: absolute;
    top: 0;
    right: 0;
    padding-right: 6px;
    font-size: 1.5rem;
    color: $light-color;

    &:hover {
      font-size: 1.7rem;
    }
  }

  .active-copy-code-btn {
    color: $active-color;
    font-size: 1.7rem;
  }
}

#search-content {
  height: 100%;
  font-size: 0 !important;
  display: flex;
  margin-left: 12px;

  .search-int {
    height: 28px;
    font-size: 14px;
    padding: 4px 8px;
    font-weight: 400;

    &:focus {
      outline: 0;
    }

    &:focus-visible {
      outline: 0;
    }
  }

  .search-btn {
    font-size: 1.4rem;
    height: 28px;
    padding: 4px 8px;
    border-left: 0;
    font-weight: 400;
    cursor: pointer;

    &:hover {
      color: #1565c0 !important;
    }
  }
}

/* midia */
@media only screen and (max-width: 768px) {
  #search-content {
    margin-bottom: 15px;
    flex-direction: column;
    margin-left: 0;

    .search-btn {
      margin-top: 12px;
    }
  }
}

@media only screen and (min-width: 768px) {
  #search-content {
    .search-btn {
      border-left: 0 !important;
    }
  }
}

/* dark model */
.colorscheme-dark {
  .navigation {
    background-color: $dark-bg-color;
  }

  #search-content {
    .search-int {
      border: 1px solid $dark-bd-color;
      background-color: $dark-bg-color;
      color: $light-color;

      &::placeholder {
        color: $dark-bd-color;
      }
    }

    .search-btn {
      border: 1px solid $dark-bd-color;
      background-color: $dark-bg-color;
      color: $light-color;
    }
  }

  .taxonomy {
    sup {
      color: $dark-color;
    }
  }

  #table-of-contents-wapper {
    summary {
      background-color: $dark-bg-color;
    }

    #table-of-contents {
      background-color: $dark-bg-color;
    }
  }
}

/* light model */
.colorscheme-light {
  .navigation {
    background-color: $light-bg-color;
  }

  #search-content {
    .search-int {
      border: 1px solid $light-bd-color;
      background-color: $light-bg-color;
      color: $dark-bg-color;

      &::placeholder {
        color: rgba(33, 33, 33, .7);
      }
    }

    .search-btn {
      border: 1px solid $light-bd-color;
      background-color: $light-bg-color;
      color: $dark-bg-color;
    }
  }

  #table-of-contents-wapper {
    summary {
      background-color: $light-bg-color;
    }

    #table-of-contents {
      background-color: $light-bg-color;
      position: relative;
    }
  }
}

/* 覆盖本地css */
.pagination {
  li {
    padding: 0 4px !important;
  }
}

.content {
  margin-top: 0 !important;

  .container {
    min-width: calc(100% - 40rem);
  }
}

.navigation {
  height: auto !important;
  z-index: 999;
  position: sticky;
  top: 0;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .12);

  .container {
    min-width: calc(100% - 40rem);
  }

  .navigation-title {
    font-size: 2.5rem !important;
  }
}

.post-meta {
  .icon {
    margin-right: 4px;
  }
}

#table-of-contents-wapper {
  user-select: none;
  position: fixed;
  right: 1em;
  top: 4em;
  border-radius: 8px;
  z-index: 999;

  @media only screen and (min-width: 768px) {
    &[open] summary {
      position: relative;
      left: 5.8em;
    }
  }

  @media only screen and (max-width: 768px) {
    top: auto;
    right: auto;
    bottom: 1.8rem;
    left: 1.8rem;
  }

  summary {
    display: inline-block;
    font-size: 1.5em;
    border-radius: 4px;
    cursor: pointer;
    padding: .2em;
  }

  #table-of-contents {
    line-height: 1.3;
    width: 19rem;
    font-size: .8rem;
    padding: .8em;
    border: 1px solid currentColor;
    border-radius: 6px;
    overflow-y: scroll;
    max-height: calc(100vh - 20rem);
    color: currentColor;

    a {
      width: 100%;
      display: inline-block;
      color: currentColor;
      line-height: 1.3;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .active {
      border-left: 2px solid #42a5f5;
      color: #42a5f5;
    }
  }
}

.content {
  h1,h2,h3 {
    padding-top: 2em !important;
    margin-top: -2em !important;
  }
}